package com.wyy.todo.graphqlerror;

import graphql.ErrorClassification;
import graphql.ErrorType;
import graphql.language.SourceLocation;

import java.util.List;

public class DataFetchingException extends AbstractGraphQLException{

    public DataFetchingException(Type type) {
        super(type.description);
    }

    public enum Type {
        EXPIRED("Schedules already exists"),
        UPDATE_FAIL("Update fail"),
        PARAM_ISEMPTY("The parameter is empty"),
        NOT_FOUND("Schedules does not exist");

        private final String description;

        Type(String description) {
            this.description = description;
        }
    }

    @Override
    public List<SourceLocation> getLocations() {
        return null;
    }

    @Override
    public ErrorClassification getErrorType() {
        return ErrorType.DataFetchingException;
    }
}
